!!$c$
!!$c$ The program reads a xtc file using the fxtc library. A pdb file need
!!$c$ to be provided.
!!$c$
!!$c$ Use F_openfile to open the pdb and the xtc files. The pdb must contains all atoms
!!$c$ of the system.
!!$c$
!!$c$ Use F_readlabels to read the atomic labels and place them in the character array labs
!!$c$
!!$            
!!$ The program reads a xtc file using the fxtc library. A pdb file need  
!!$ to be provided.
!!$ 
!!$ Use F77_openfile to open the pdb and the xtc files. The pdb must contains all atoms 
!!$ of the system.
!!$ 
!!$ Use F77_readlabels to read the atomic labels and place them in the character array labs
!!$
!!$ Use F77_readnext to read the co matrix (the box vector coordinates) and the coordinates 
!!$ of all the atoms of the system. F77_readnext is a function returning the step number  
!!$ which has been read. This function has an additional argument; when this is .true. 
!!$ the step is skipped and no coordinates are transferred; when .false. the coordinates
!!$ are read normally.
!!$
!!$
      program main
      character*140 pdb,xtc
      integer ndim,n,step,o
      parameter(ndim=200000)
!!c    ndim is the size of the arrays
      real(4) x(ndim),y(ndim),z(ndim),co(ndim)
      character*4 labs(ndim)
      logical skip
!!c pdb: filename of the .pdb file
!!c xtc: filename of the .xtc file
!!c n  : the number of atoms must be =< ndim

      READ(5,*) pdb,xtc,n
      if(n .gt. ndim) then
         write(*,*) "Stop here: n is larger than ndim "
         stop
      endif
      call F77_openfiles(pdb,xtc,n)
      call F77_readlabels(labs,n)

!!$
!!$ Skip 5 steps
!!$
      skip=.true.
      do 100 o=1,5
         call F77_readnext(step,co,x,y,z,skip,n)
         if(step .lt. 0) goto 200
100   continue
200   continue
!!$
!!$ Read 96 steps.
!!$
      skip=.false.
300   continue
      call F77_readnext(step,co,x,y,z,skip,n)
!!$ If step < 0 program stops !!
      if(step .lt. 0 .or. step .eq. 100) goto 400
      write(*,*) step,x(10),y(10),z(10)
      goto 300
400   continue

      end
